home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Jan 26, 1999
- // Author: vangelis
- //
- // Description:
- // This script returns the weights of the selected
- // smooth skin components/objects to their default value
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
-
- global proc performResetToDefault()
- //
- // Description:
- // This procedure returns the smooth skin weights of the
- // selected objects/components to their default values by executing
- // the "skinPercent -rtd $skinCluster" command. It uses the
- // current selection list to extract the objects and components.
- // When transforms are selected then the whole hierarchy of skinned
- // surfaces under them will be included in the command.
- //
- {
- // Find all the selected components
- //
- string $sel[] = `ls -sl`;
-
- // Find the selected shapes
- //
- string $allShapes[] = `ls -sl -lf -dag -o`;
-
- string $shape;
- int $count = 0;
- for ($shape in $allShapes)
- {
- // Ignore if it is an intermediate object
- //
- int $io = `getAttr ($shape+".io")`;
- if ($io == 1)
- continue;
-
- string $parentL[] = `listRelatives -parent $shape`;
- string $parent = $parentL[0];
-
- // Get the skinCluster attached to the object
- //
- string $skinCluster = findRelatedSkinCluster($shape);
- if ($skinCluster == "")
- continue;
-
- // Loop though all the selected components
- // and select the ones that are related to the current shape
- //
- select -cl;
- string $comp;
- string $buf[];
- for ($comp in $sel)
- {
- int $tok = tokenize($comp,".",$buf);
-
- // Component
- //
- if ($tok == 2 && $buf[0] == $parent)
- select -add $comp;
-
- // Whole shape
- //
- if ($tok == 1 && $buf[0] == $parent)
- {
- select -r $parent;
- break;
- }
- }
-
- // If the selection list is empty then select the
- // whole shape
- //
- string $newSel[] = `ls -sl`;
- if (size($newSel)== 0)
- select -r $parent;
-
- // Execute the command for the given skin cluster
- //
- string $cmd = "skinPercent -rtd "+ $skinCluster;
- catch(evalEcho($cmd));
- $count++;
- }
- // Reset the selection
- //
- select -r $sel;
-
- if ($count == 0) {
- error("No skinned items were selected.");
- }
-
- }
-
-
-